package com.macro.mall.pms.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.macro.mall.pms.entity.SkuEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * sku mapper
 *
 * @author xuyanjun
 * @date 2019-12-13
 */
public interface SkuMapper extends BaseMapper<SkuEntity> {

    /**
     * 递增销量
     *
     * @param id            商品id
     * @param increaseCount 递增数量
     */
    @Update("update pms_sku_stock set sale=ifnull(sale,0)+#{increaseCount} where id=#{id};")
    int increaseSale(@Param("id") long id, @Param("increaseCount") int increaseCount);
}

